(define-module (python localslackirc)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix build-system python)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages time)
  #:use-module (guix packages)
  #:use-module (guix download))

(define-public python-typedload
  (package
    (name "python-typedload")
    (version "2.0")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "typedload" version))
       (sha256
        (base32
         "050yvpaqv00r7lg3341iv90j2vjsj64ifqhphiz68llycmia8gn8"))))
    (build-system python-build-system)
    (home-page "https://github.com/ltworf/typedload")
    (synopsis
     "Load and dump data from json-like format into typed data structures")
    (description
     "Load and dump data from json-like format into typed data structures")
    (license #f)))

(define-public localslackirc
  (package
    (name "localslackirc")
    (version "1.7")
    (source
     (origin
       (method url-fetch)
       (uri "https://github.com/ltworf/localslackirc/releases/download/1.7/localslackirc_1.7.orig.tar.gz")
       (sha256
        (base32
         "14cx0wjz7rqhpx0b6fl89gnp5pr5ncrgbpfl8hzh7fll93c1jkh0"))
       (modules '((guix build utils)))
       (snippet
        '(begin
           (substitute* "Makefile"
             ;; do not leak information about the build host
             (("/usr/")
              "/"))
           #t))))
    (build-system python-build-system)
    (arguments
     `(#:tests? #f
       #:phases
       (modify-phases %standard-phases
         (delete 'build)
         (delete 'check)

         ;; (wrap-program (string-append newbin "/fiologparser_hist.py")
         ;;   `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH"))))
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out")))
               (invoke "make" (string-append "DESTDIR=" out) "install"))
             #t))
         (add-after 'install 'wrap
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out"))
                   (python-path (getenv "PYTHONPATH")))
               (wrap-program (string-append out "/bin/localslackirc")
                 `("PYTHONPATH" ":" prefix (,python-path))))
             #t)))))
    (propagated-inputs
     `(("python-requests" ,python-requests)
       ("python-websocket-client" ,python-websocket-client)
       ("python-typedload" ,python-typedload)))
    (home-page "https://github.com/ltworf/localslackirc")
    (synopsis
     "TODO")
    (description
     "TODO")
    (license #f)))

localslackirc
